<template>
    <div id="activities">
      <div v-show="false" class="bannerBox"></div>
      <div class="title vux-1px-b flex-row flex-y-center">
        <div class="tit_icons flex-grow-0"><img v-src="'/static/img/activities_icon.png'" alt=""></div>
        <div class="flex-grow-1">今日推广活动</div>
      </div>
      <div class="container">
        <div @click="toDetails(item.id)" class="list-item vux-1px-b" v-for="(item,index) in listData">
          <div class="list-img">
            <img v-src="item.recommendPagePic" alt="">
            <div v-show="item.iconPic" class="l_t_icon" :style="{backgroundImage:`url(${item.iconPic})`}"></div>
          </div>
          <div class="list-info">
            <div class="list-info-mall">
              <span>{{item.insertTime | bijiaoshijian}} {{(item.insertTime).substr(11).substr(0,5)}}</span>
              {{item.platformType}}
            </div>
            <p class="desc oneLine">{{item.title}}</p>
            <p class="youhui">{{item.subtitle}}</p>
            <div v-show="false" class="list-info-tips">
              <span class="icon_look icons"></span>
              <em>367</em>
              <span class="icon_comment icons"></span>
              <em>1212</em>
            </div>
          </div>
        </div>
      </div>
    </div>
</template>
<script>
  import {RUI_GETACTIVITIESLIST} from 'src/const/uri'
  export default{
    data(){
      return {
        listData:[],
      }
    },
    created(){
      this.initData();
    },
    mounted(){
      let spinner=document.getElementsByClassName('spinner')[0];
      spinner.style.display='none';
    },
    methods:{
      initData(){
        this.$ajax.get(RUI_GETACTIVITIESLIST,{
          reqPage:1,
          reqPageSize:10
        },(res)=>{
          console.log('请求成功');
          console.log(res.data.data);
          this.listData=res.data.data;
        });
      },
      refreshData(responseCallback) {
        this.initData();
        responseCallback({code: '0'});
      },
      toDetails(id){
        let Url = document.URL.replace(/PromotionalActivities\/AppPromotionalActivities/g, "activitiesDetails/AppActiviesDetails").split('?')[0];
        let toUrl=`${Url}?id=${id}`;

        if (window.WebViewJavascriptBridge) {
          window.WebViewJavascriptBridge.callHandler('jumpTo', toUrl);
        } else if (isDebug) {
          window.location.href = toUrl;
        }
        //window.location.href=toUrl;
       // window.open(toUrl)
      }
    }

  }
</script>
<style lang="less" scoped>
  @import "AppActivities";
</style>
